<html>

	<head>
		<title>商品查询管理</title>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">

		<link href="../../css/skin/default/style.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" href="../../css/dialog.css">
		<link href="../../js/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />

		<script src="../../js/lib/jquery/jquery-1.10.2.min.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>

		<script src="../../js/lib/ligerUI/js/plugins/ligerPopupEdit.js"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerForm.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerRadio.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTip.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerMenu.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerToolBar.js" type="text/javascript"></script>
		<script src="../../js/lib/jquery.form.js" type="text/javascript"></script>
		<script src="../../js/lib/json2.js" type="text/javascript"></script>
		<script src="../../js/dialog.js"></script>
		<script src="../../js/JS/layout.js"></script>
		<script src="../../js/constants.js" type="text/javascript"></script>
		<script src="../../js/api.js" type="text/javascript"></script>

		<script type="text/javascript">
			var manager;
			$(document).hover(parent.hindMenu);

			var productUrl = BaseUrl + "Sku?token=" + $api.getStorage("token") + "&fpid=" + $api.getparastr("Fpid");

			$(function() {
				$("form").ligerForm();

				manager = $("#maingrid4").ligerGrid({
					columns: [{
							display: '商品信息',
							name: 'title',
							align: 'left',
							minwidth: 380,
							render: function(rowdata, rowindex, value) {

								var Fattr = "";
								var arr = [];
								if(rowdata.Fattr) {
									arr = JSON.parse(rowdata.Fattr);
								}
								for(var i in arr) {
									var row = arr[i];
									Fattr += row.Fattr + ":" + row.Fvalue + "；";
								}
								var ret = "<img src=" + rowdata.Fimg + " class='listimgs' style='float:left;top:5px' />";
								ret += "<div style='float:left; margin-left:5px'><div style='font-size:14px' >"+Fattr + "</div>";

								ret += "</div>"
								return ret;

							}
						},
						{
							display: '销售状态',
							name: 'Fc1',
							width: 120,
							isSort: true,
							render: function(rowdata, rowindex, value) {
								if(rowdata.Fc1 == 0)
									return "已下架<a class='listbtn' style='margin-top:15px;width:60px;margin-left:5px;'  onclick='doupdown(" + rowindex + ",1);'>上架</a>";
								return "已上架<a class='listbtn' style='margin-top:15px;margin-left:5px;width:60px;'  onclick='doupdown(" + rowindex + ",0);'>下架</a>";

							}
						},
						{
							display: '售价',
							name: 'Flowprice',
							isSort: true,
							width: 140,
							align: 'left',
							render: function(rowdata, rowindex, value) {
								return "库存数:" + rowdata.Fstocknum + rowdata.Funitname +
									"<br/>已售数量:" + rowdata.Fsalenum + rowdata.Funitname +
									"<br/>销售单价:￥" + rowdata.Fsaleprice;
							}
						}

					],
					dataAction: 'local',
					url: productUrl,
					method: 'get',
					width: '99.5%',
					height: '90%',
					rowHeight: 100,
					usePager: false
				});
			});

			function doupdown(i, updown) {
				var row = manager.getRow(i);
				var url = productUrl + "&Ftid=" + row.Fskuid + "&updown=" + updown;
				$api.ajaxapp2(url, {}, function(data) {
					manager.reload(true);
				});
			}
		</script>

	</head>

	<body class="mainbody2">
		<form id="form1" onsubmit="return false">
			<div class="alarm">
				友情提示：只有上架中的商品才能在小程序商城中正常销售。
			</div>

			<div id="maingrid4" style="margin: 0px;background:#fff;"></div>

		</form>

	</body>

</html>